home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1998 May / PCPlus May 1998=disk A.iso / trial / gdldb / disk1 / data1.cab / Example_Files / workweb2.scp < prev    next >
Encoding:
Text File  |  1998-01-21  |  7.4 KB  |  274 lines

  1. ##########################################################
  2. # GDIdB demo script (c) 1997 Global Data Industries
  3. # Datasource=workweb.mdb (Access database)
  4. #
  5. # In this example, SQL queries are made to extract the
  6. # different categories of jobs contained in a single
  7. # database table. Because the jobs in each category are
  8. # the result of a database search, care is needed to define
  9. # SQL search criteria that will accurately sort the data.
  10. # It is always possible that some jobs will not be included
  11. # under any category, and that some jobs will be included
  12. # in several categories.
  13. ##########################################################
  14.  
  15.  
  16.  
  17. ##########################################################
  18. # variable catpagecount is used to generate a unique link
  19. # for each of the category pages, and for the pages linked
  20. # under each category. It is incremented once for each
  21. # category produced.
  22.  
  23. &defvar(?catpagecount?)
  24. &assign(?catpagecount?,1)
  25.  
  26.  
  27. ##########################################################
  28. # Print the information screen
  29.  
  30. &cls
  31. &print("WorkWeb 2 Demo Script")
  32. &print("-----------------------------------")
  33.  
  34.  
  35.  
  36. ##########################################################
  37. # declare the ODBC data source
  38.  
  39. &datasource("Driver={Microsoft Access Driver (*.mdb)};DBQ=workweb.mdb")
  40.  
  41.  
  42.  
  43.  
  44. ##########################################################
  45. # call the subroutine that generates the top-level HTML
  46. # index page
  47.  
  48. &indexpage
  49.  
  50.  
  51.  
  52. ##########################################################
  53. # Create and fill each of the job categories using &jcat
  54. # subroutine. (Defined later in the script) The first
  55. # argument to the function is used as the category name,
  56. # the second is used in the SQL query to fetch relevent
  57. # job vacencies.
  58.  
  59. # Analogue Engineers
  60. &jcat("Analogue Engineers","Analogue")
  61.  
  62. # Software Engineers
  63. &jcat("Software Engineers","software")
  64.  
  65. # HTML Authors
  66. &jcat("HTML Authors","html")
  67.  
  68. # RF Engineers
  69. &jcat("R.F. Engineers","rf")
  70.  
  71. # Hardware Engineers
  72. &jcat("Hardware Engineers","hardware engineer")
  73.  
  74. # ASIC Engineers
  75. &jcat("ASIC Engineers","asic")
  76.  
  77.  
  78.  
  79.  
  80. ##########################################################
  81. # print the finishing message
  82.  
  83. &msgbox("All done!",iconinformation)
  84. &cls
  85. &print("Demo web site HTML generation complete. Click the HTML button to see the results.")
  86. &print
  87. &print
  88.  
  89. # END OF SCRIPT
  90.  
  91.  
  92.  
  93.  
  94. ##########################################################
  95. # SUBROUTINES
  96.  
  97.  
  98. ##########################################################
  99. # This is the top-level page containing links to the pages
  100. # created from the database searches. This page is actually
  101. # static (it contains no database data) so could be created
  102. # as a normal HTML file and left on the web server.
  103. # It has been included in this script merely for information.
  104.  
  105. &defsub("indexpage")
  106. {
  107. &html ("index.html")
  108. {
  109. <HTML>
  110. <HEAD>
  111. <TITLE>Work Web</TITLE>
  112. </HEAD>
  113. <BODY BACKGROUND="wwbg1.gif" LINK=BLACK VLINK=BLACK ALINK=WHITE>
  114. <FONT FACE="Verdana,Helvetica">
  115. <IMG SRC="ww1.gif">
  116. <BR><BR><BR><BR><BR><BR>
  117. <TABLE CELLPADDING=10 CELLSPACING=10 BORDER=0 WIDTH="100%">
  118. <TR>
  119. <TD VALIGN=TOP>
  120. <FONT FACE="Verdana,Helvetica">
  121. <FONT SIZE="+2">Select a Job Category:</FONT>
  122. <BR><BR>
  123. <UL>
  124.  
  125.  
  126. # subroutine jcat will produce all of the files that link
  127. # to the following links
  128. <LI><A HREF="cat1.html" onMouseover="window.status='View Jobs in category Analogue Engineers';return true">Analogue Engineers</A><BR>
  129. <LI><A HREF="cat2.html" onMouseover="window.status='View Jobs in category Software Engineers';return true">Software Engineers</A><BR>   
  130. <LI><A HREF="cat3.html" onMouseover="window.status='View Jobs in category HTML Authors';return true">HTML Authors</A><BR> 
  131. <LI><A HREF="cat4.html" onMouseover="window.status='View Jobs in category RF Engineers';return true">RF Engineers</A><BR> 
  132. <LI><A HREF="cat5.html" onMouseover="window.status='View Jobs in category Hardware Engineers';return true">Hardware Engineers</A><BR> 
  133. <LI><A HREF="cat6.html" onMouseover="window.status='View Jobs in category  ASIC Designers';return true">ASIC Designers</A><BR> 
  134. </UL>
  135. </FONT>
  136. </TD>
  137. <TD WIDTH="45%" VALIGN=TOP><FONT FACE="Verdana,Helvetica">
  138. <B>This Site</B> demonstrates the use of GDI's Database
  139. publishing software. A single database table consisting of
  140. jobs is grouped into job categories, this is merged with the web site
  141. HTML and passed to the web server <I>automatically.</I> 
  142. </FONT>
  143. </TD>
  144. </TR>
  145. </TABLE>
  146. <BR><BR><BR>
  147. <TABLE CELLPADDING=10 CELLSPACING=10 BORDER=0 WIDTH="100%">
  148. <TR>
  149. <TD>
  150. <FONT FACE="Verdana,Helvetica"> 
  151. <B>System Bullet points:</B>
  152. <UL>
  153. <LI> Totally automated publishing of database and spreadsheet data using a dial-up Internet connection.
  154. <LI> The database does not need to be stored on the web server.
  155. <LI> No specialist knowledge is required by web site maintainer.
  156. <LI> Zero administration overhead- Just set the times/days when you
  157. want to update your web site from your database and forget it!
  158. </UL>
  159. </FONT>
  160. </TD>
  161. </TR>
  162. </TABLE>
  163. <CENTER>
  164. <FONT FACE="Helvetica">
  165. <BR><BR>
  166. <I>Web site design by:</I><BR>
  167. <A HREF="http://www.gd-ind.com">GLOBAL DATA INDUSTRIES</A>
  168. </CENTER>
  169. </FONT>
  170. </BODY>
  171. </HTML>
  172. }
  173. }
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181. ##########################################################
  182. # Subroutine jcat handles the creation of the job category
  183. # pages, and is called once for each job category processed.
  184. # The function uses values passed as arguments, these are
  185. # accessed in the subroutine using ?argv? variable array.
  186. # Note the use of nested &html functions in this subroutine,
  187. # where the job content page is generated 1/2 way through
  188. # the generation of the job category page
  189.  
  190. &defsub("jcat")
  191. {
  192. &html("cat?catpagecount?.html")
  193. {
  194. &print("Creating category ?catpagecount?")
  195. &inc(?catpagecount?)
  196. <HTML>
  197. <HEAD>
  198. <TITLE>Jobs List</TITLE>
  199. </HEAD>
  200. <BODY BACKGROUND="wwbg1.gif" LINK=BLACK VLINK=BLACK ALINK=WHITE>
  201. <FONT FACE="Verdana,Helvetica">
  202. <TABLE WIDTH="80%" CELLSPACING=10 BORDER=0>
  203. <TR>
  204. <TD><IMG SRC="wwbullet1.gif"></TD>
  205. <TD>
  206. <FONT SIZE="+3" FACE="Verdana,Helvetica">
  207. ?argv[1]?
  208. </FONT>
  209. </TD>
  210. </TR>
  211. </TABLE>
  212. <UL><UL>
  213.  
  214.  
  215. # this subroutine uses functions &sql, &if and &foreachrow.
  216. # A slightly simpler alternative would be to use the &getdata
  217. # function followed by a &else function.
  218.  
  219. &sql("SELECT * FROM Jobs WHERE JobDesc Like '%?argv[2]?%'")
  220. {
  221.    &if (?recordsetsize?==0)
  222.    {
  223.       Sorry! We currently have no jobs in this category.
  224.    }
  225.    
  226.     
  227.    &foreachrow
  228.    {
  229.       <LI><A HREF="p?catpagecount?n?rownumber?.html" onMouseover="window.status='View Job (?JobTitle?) details.';return true">?JobTitle?</A>
  230.       &html("p?catpagecount?n?rownumber?.html")
  231.       {
  232.          <HTML>
  233.          <HEAD>
  234.          <TITLE>Job Description</TITLE>
  235.          </HEAD>
  236.          <BODY BACKGROUND="wwbg1.gif">
  237.          <TABLE WIDTH="80%" CELLSPACING=10 BORDER=0>
  238.          <TR>
  239.          <TD><IMG SRC="wwbullet1.gif"></TD>
  240.          <TD>
  241.          <FONT SIZE="+2" FACE="Verdana,Helvetica">
  242.          ?JobTitle?
  243.          </FONT>
  244.          </TD>
  245.          </TR>
  246.          </TABLE>
  247.          <CENTER>
  248.          <TABLE WIDTH="90%" CELLSPACING=10 BORDER=0>
  249.          <TR>
  250.          <TD>
  251.          <FONT FACE="Verdana,Helvetica"SIZE="+1">Job ref: ?JobNo?</FONT>
  252.          <TT>
  253.          <FONT SIZE="+1"><P>?JobDesc?</FONT></TT>
  254.          </TD>
  255.          </TR>
  256.          </TABLE>
  257.          </CENTER>
  258.          </BODY>
  259.          </HTML>
  260.       }
  261.    }
  262. }
  263.  
  264. </UL></UL>
  265. </FONT>
  266. </BODY>
  267. </HTML>
  268. }
  269.  
  270. }
  271.  
  272.  
  273.  
  274.